package com.chrray.position.controller.web;

import com.baomidou.mybatisplus.extension.api.R;
import com.chrray.position.domain.FdUser;
import com.chrray.position.domain.dto.*;
import com.chrray.position.domain.vo.FdFeedbackVO;
import com.chrray.position.domain.vo.FdUserResumeVO;
import com.chrray.position.entity.position.FdPostingsUserExeVo;
import com.chrray.position.entity.position.FdUserExe;
import com.chrray.position.pojo.dto.BaseIdDto;
import com.chrray.position.pojo.dto.auth.AllRoleUpRequest;
import com.chrray.position.pojo.dto.web.FdUserStateDto;
import com.chrray.position.service.position.FdUserService;
import com.chrray.position.service.web.WFdUserService;
import com.chrray.position.util.result.PageBean;
import com.chrray.position.util.result.ResponseResult;
import com.github.pagehelper.IPage;
import com.github.pagehelper.Page;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import static com.chrray.position.util.result.ResponseResults.PAGE;
import static com.chrray.position.util.result.ResponseResults.success;

/**
 * 业务系统用户控制器
 *
 * @author lm
 * @since 1.0.1 2024-09-02
 */
@RestController
@RequestMapping("/api/web/fdUser")
@Api(tags = "用户列表")
@AllArgsConstructor
public class WFdUserController {
    @Autowired
    private WFdUserService wFdUserService;


    @GetMapping("/pageList")
    @ApiOperation("列表")
    public ResponseResult<PageBean<FdUser>> pageList(FdUserExe fdUser) {
        return PAGE(wFdUserService.pageList(fdUser));
    }


    @GetMapping("/selectById")
    @ApiOperation("查询详情")
    @ApiResponses({
            @ApiResponse(code=200, message = "ok", response = FdUser.class)
    })
    public ResponseResult<FdPostingsUserExeVo> selectById(BaseIdDto dto){

        return  wFdUserService.selectById(dto.getId());
    }


    @GetMapping("/deletedById")
    @ApiOperation("删除")
    public ResponseResult<Object> deletedById(BaseIdDto dto){
        return  success(wFdUserService.removeById(dto.getId()));
    }

    @ApiOperation(value  = "启用。禁用")
    @PostMapping(value = "/upOrDownUser")
    public ResponseResult upOrDownRole( @RequestBody FdUserStateDto dto) {
        return success(wFdUserService.upOrDownUser(dto));
    }

}
